package Text1;

public class Main {
    public static void instersort(int[] arr){
        int n=arr.length;
        for (int i = 1; i <n ; i++) {
            int tmp=arr[i];
            int j = i-1;
            for (; j>=0; j--) {
                if(arr[j]>tmp){
                    arr[j+1]=arr[j];
                }else{
                    break;
                }
            }
            arr[j+1]=tmp;
        }
    }


    public static void sellsort(int[]arr){
        int gap=arr.length;
        while(gap>1){
            gap=gap/2;
            sell(arr,gap);
        }
    }

    private static void sell(int[] arr, int gap) {
        int n=arr.length;
        for (int i = gap; i <n ; i++) {
            int j =i-gap;
            int tmp= arr[i];
            for (; j>0; j-=gap) {
                if(arr[j]>tmp){
                    arr[j+gap]=arr[j];
                }else{
                    break;
                }
            }
            arr[j+gap]=tmp;
        }
    }
}
